import axios from '@/libs/axios'
let jsonHeaders = { 'content-type': 'application/json;charset=UTF-8' }
let base = '/api/testplatform/vulnerability'

// 查询公共漏洞列表
export const queryCommonVulnerabilityList = params => {
  return axios({
    url: `${base}`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}

// 创建公共漏洞
export const addCommonVulnerability = data => {
  return axios({
    url: `${base}`,
    method: 'POST',
    data,
    headers: jsonHeaders,
  })
}

// 修改公共漏洞
export const updateCommonVulnerability = data => {
  return axios({
    url: `${base}`,
    method: 'PUT',
    data,
    headers: jsonHeaders,
  })
}

// 删除公共漏洞
export const deleteCommonVulnerability = id => {
  return axios({
      url: `${base}/${id}`,
      method: 'DELETE',
      headers: jsonHeaders,
  })
}

// 查询漏洞影响力
export const getVulnerabilityScopeAnalysis = data => {
  return axios({
      url: `${base}/vulnerabilityScopeAnalysis`,
      method: 'POST',
      data,
      headers: jsonHeaders,
  })
}

// 查询漏洞对网络的影响力
export const getVulnerabilityScopeAnalysisBynetwork = data => {
  return axios({
      url: `${base}/analysisOfNetworkAssetVulnerability`,
      method: 'POST',
      data,
      headers: jsonHeaders,
  })
}
//漏洞导出
export const getLeakUrl = params => {
  return axios({
    url: `${base}/vulnerabilityExport`,
    method: 'GET',
    params,
    headers: jsonHeaders
  })
}